import React from 'react';
import TimelineOutlined from '@material-ui/icons/TimelineOutlined';
import { NavView, get_mod, loc, NavListSub } from 'sui';
import { TaskView } from './task/view';
import { TraceView } from './trace/view';
import { UserView } from './user';

const model = (cfg) => {
    const fix = [
        {uid: "sale.task", view: TaskView,  value: loc("l_453")},
        {uid: "sale.trace", view: TraceView,  value: loc("l_860")},
        {uid: "sale.custom", view: UserView,  value: loc("l_520")},
    ];

    return get_mod(cfg, fix, "sale");
};

const Sale = ({ mod, sideopen, cfg }) => <NavView cfg={cfg} model={model(cfg)} mod={mod} sideopen={sideopen} name="sale"/>;

const NavSale = (props) => <NavListSub icon={<TimelineOutlined/>} sub={model(props.cfg)} {...props} scut={15}/>;

export {NavSale, Sale};
